home *** CD-ROM | disk | FTP | other *** search
- Path: nnrp.info.ucla.edu!usenet
- From: mael1@ucla.edu (Matt Waggoner)
- Newsgroups: comp.lang.c++
- Subject: Null Pointer Assignment
- Date: 14 Mar 1996 03:43:09 GMT
- Organization: University of California, Los Angeles
- Message-ID: <4i84kd$1lh4@saba.info.ucla.edu>
- NNTP-Posting-Host: s187_40.resnet.ucla.edu
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.6
-
- I have a class called City that contains a private data member, char *name.
- The constructor receives an argument called char *s. The constructor looks
- like this:
-
- City::City(char *s)
- {
- name = new char(strlen(s));
- name = s;
- }
-
- The program works fine, but I get a NULL POINTER ASSIGNMENT whenever it
- terminates. What the HELL causes this, and how do I get rid of it? A quick
- answer would be good, I'm under a bit of time pressure... thanks in advance.
-
- --------------------------------------------------------------
- Matt Waggoner
- mael1@ucla.edu
- In the beginning, there was nothing, and God said, "Let there
- be light," and there was still nothing, but you could see it.
- --------------------------------------------------------------
-
-